package ui.listeners;

import org.apache.pivot.wtk.Action;
import org.apache.pivot.wtk.Component;

import ui.window.MDKWindow;

public class ToolbarListener {
	private final MDKWindow appli;
	
	public ToolbarListener(final MDKWindow appli){
		this.appli=appli;
		
		gereActionSwitchConverser();
		gereActionSwitchEditor();
		gereActionSwitchConsole();
	}
	
	private void gereActionSwitchConverser(){
		Action.getNamedActions().put("switchToConv", new Action() {
		            
            public void perform(Component source) {
            	appli.switchToConverser();
            }
        });
	}
	
	private void gereActionSwitchEditor(){
		Action.getNamedActions().put("switchToEdit", new Action() {
            
            public void perform(Component source) {
            	appli.switchToEditor();
            }
        });
	}
	
	private void gereActionSwitchConsole(){
		Action.getNamedActions().put("switchToCons", new Action() {
            
            public void perform(Component source) {
            	appli.switchToConsole();
            }
        });
	}
}
